package com.uzai.console.web.tb.tbstoreblacklist;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.tb.tbstoreblacklist.StoreBlacklistPubIdDto;
import com.uzai.console.dto.tb.tbstoreblacklist.StoreBlacklistPubQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.tb.tbstoreblacklist.StoreBlacklistPubService;
import com.uzai.console.vo.tb.tbstoreblacklist.StoreBlacklistPubInfoVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户管理|云黑名单|共享黑名单
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "店铺全网黑名单",tags = "淘宝|店铺黑名单|全网黑名单")
@ApiSort(9)
@RestController
public class TbStoreBlacklistPubController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(TbStoreBlacklistPubController.class);

    @Autowired
    private StoreBlacklistPubService storeBlacklistPubService;

    @ApiOperation(value = "分页查询全网黑名单列表", notes = "分页查询全网黑名单列表", response = StoreBlacklistPubInfoVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/storeBlacklistPub/findStoreBlacklistPubList")
    public Object findStoreBlacklistPubList(@RequestBody StoreBlacklistPubQuery storeBlacklistPubQuery){
        return storeBlacklistPubService.findStoreBlacklistPubList(storeBlacklistPubQuery);
    }

    @SystemLogType(model = SystemModelEnum.TbStoreBlacklistPub, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "加入白名单", notes = "加入白名单")
    @ApiOperationSupport(order = 2)
    @PostMapping("/storeBlacklistPub/addStoreBlacklistPubWhite")
    public Object addStoreBlacklistPubWhite(@RequestBody StoreBlacklistPubIdDto storeBlacklistPubIdDto){
        storeBlacklistPubService.addStoreBlacklistPubWhite(storeBlacklistPubIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.TbStoreBlacklistPub, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "取消白名单", notes = "取消白名单")
    @ApiOperationSupport(order = 3)
    @PostMapping("/storeBlacklistPub/deleteStoreBlacklistPubWhite")
    public Object deleteStoreBlacklistPubWhite(@RequestBody StoreBlacklistPubIdDto storeBlacklistPubIdDto){
        storeBlacklistPubService.deleteStoreBlacklistPubWhite(storeBlacklistPubIdDto);
        return true;
    }
}
